# This shell first geneartes TranSEQ's input based on PerM's mapping result
# It calls the TranSEQ to estimate the abundance levels of isoforms.
PANF=/home/cmbpanfs-01/yanghoch
if [ $# -ne 2 ]; then
	echo "The 1st arg needed is the genename, corresponding to:"
	echo "(1) genename.isoforms, which contains the length info of isoforms."
	echo "(2) genename.mapping, which is used for the abundance level."
	echo "The 2nd arg is the output file" 
	exit
fi 
if test ! -s "$1.mapping" ; then
	echo "$1.mapping not found" 
	exit
fi
echo "Generate the TranSEQ input" 
python ~/SCRIPT/PerMin2TranSEQout.py $1
echo ""
echo "Run TranSEQ"
TranSEQ_OUT=$2 
$PANF/TranSEQ $1.dat 0.00000001 $TranSEQ_OUT
cat $TranSEQ_OUT | sort -k 2,2n > tmp.tmp
mv tmp.tmp $TranSEQ_OUT





